<%-- 
    Document   : disciplinas
    Created on : 23/05/2013, 14:40:07
    Author     : Eduardo
--%>

<%@page import="java.util.*"%>
<%@page import="java.sql.*" %> 
<%@page import="java.io.*" %>
<%@page import="Controller.*" %>
<%@page import="Model.*"%>

<%
    
    Query s = new Query();
    ResultSet rss = s.getSolicitacoes(null);
    int rowCount = 0;
    
    while (rss.next()) {
        rowCount++;
    }
    
    String pg = request.getRequestURI().substring(request.getContextPath().length());
    pg = pg.replace("/", "");
    if (pg.equals("")) {
        pg = "index.jsp";
    } else if (pg.equals("home.jsp")) {
        pg = "home";
    } else if (pg.equals("professores.jsp")) {
        pg = "professores";
    } else if (pg.equals("disciplinas.jsp")) {
        pg = "disciplinas";
    } else if (pg.equals("salas.jsp")) {
        pg = "salas";
    } else if (pg.equals("horarios.jsp")) {
        pg = "horarios";
    } else if (pg.equals("info.jsp")) {
        pg = "informacoes";
    } else if (pg.equals("solicitacoes.jsp")) {
        pg = "solicitacoes";
    }
    if (session.getAttribute("talogado") == null) {
        session.setAttribute("error", "Você precisa estar logado!");
        response.sendRedirect("login.jsp");
        return;
    }

%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <title>Alocação de Recursos</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Bootstrap -->
        <link href="css/bootstrap.css" rel="stylesheet" media="screen">
        <link href="css/bootstrap-responsive.css" rel="stylesheet" media="screen">
        <link href="css/bootstrap-modal.css" rel="stylesheet" media="screen">
        <link href="css/jquery.dataTables.css" rel="stylesheet" media="screen">

        <style>
            body {padding-top:70px !important;}
        </style>

        <script src="js/jquery.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script src="js/bootstrap-modalmanager.js"></script>
        <script src="js/script.js"></script>        
        <script src="js/jquery.dataTables.min.js"></script>
    </head>
    <body>


        <div class="navbar navbar-fixed-top">
            <div class="navbar-inner">
                <div class="container-fluid">
                    <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="brand" href="home.jsp">DELC</a>
                    <div class="nav-collapse collapse">
                        <span class="pull-right">
                            <span class="navbar-text">
                                <%
                                    if (session.getAttribute("type").equals("diretor")) {
                                        out.print("Diretor(a)");
                                    }
                                    if (session.getAttribute("type").equals("professor")) {
                                        out.print("Professor(a)");
                                    }
                                    if (session.getAttribute("type").equals("cordenador")) {
                                        out.print("Cordenador(a)");
                                    }
                                %>
                                / </span> 
                            <span class="dropdown">
                                <a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"><% out.print(session.getAttribute("nome"));%> <b class="caret"></b></a>
                                <ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
                                    <li role="presentation"><a role="menuitem" tabindex="-1" href="logout">Logout</a></li>
                                </ul>
                            </span>
                        </span>
                        <ul class="nav">
                            <li <%if (pg.equals("home")) {
                                    out.print("class='active'");
                                }%>
                                ><a href="home.jsp">Home</a></li>                            
                            <li><a href="preferencias.jsp">Editar preferências</a></li> 

                            <% if (session.getAttribute("type").equals("diretor")) {%>
                            <li <%if (pg.equals("solicitacoes")) {
                                    out.print("class='active'");
                                }%>
                                ><a href="solicitacoes.jsp"><span class="badge badge-info"><%= rowCount%></span> Solicitações</a></li>
                                <%}%>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span2">
                    <div class="well sidebar-nav">        
                        <ul class="nav nav-list">
                            <li class="nav-header">Menu Professor</li>
                            <li <%if (pg.equals("turmas")) {
                                    out.print("class='active'");
                                }%> >
                                <a href="turmas.jsp">Minhas turmas</a>
                            </li>                            
                            <%
                                if (session.getAttribute("type").equals("cordenador")) {
                            %>
                            <li class="nav-header">Menu Cordenador</li>
                            <li <%if (pg.equals("solicitar")) {
                                    out.print("class='active'");
                                }%> >
                                <a href="solicitar.jsp">Solicitar disciplina</a>                  
                            </li>
                            <li <%if (pg.equals("turmasCurso")) {
                                    out.print("class='active'");
                                }%> >
                                <a href="turmasCurso.jsp">Listar turmas</a>                  
                            </li>
                            <% }%>
                            <%
                                if (session.getAttribute("type").equals("diretor")) {
                            %>    

                            <li class="nav-header">Menu Diretor</li>
                            <li <%if (pg.equals("professores")) {
                                    out.print("class='active'");
                                }%> >
                                <a href="professores.jsp">Professores</a>
                            </li>
                            <li <%if (pg.equals("disciplinas")) {
                                    out.print("class='active'");
                                }%> >
                                <a href="disciplinas.jsp">Disciplinas</a>
                            </li>
                            <li <%if (pg.equals("salas")) {
                                    out.print("class='active'");
                                }%> > 
                                <a href="salas.jsp">Salas</a>
                            </li>
                           
                            <% }%>
                        </ul>
                    </div>
                </div>
                <div class="span10">
                    <div id="modal" class="modal hide" tabindex="-1" data-width="760"></div>
